{extend name="index/base" /}
{block name="style"}
<style type="text/css">
/*.layui-form-label{width: 150px;}*/
.upcb img{width: 40px;height: 40px;}
</style>
{/block}
{block name="body"}

<div class="layui-tab layui-tab-brief" lay-filter="test">
  <ul class="layui-tab-title">
    <li class="layui-this"  lay-id="11">首页设置</li>
    <li  lay-id="22">规则与说明</li>
    <li  lay-id="33">苹果审核设置</li>
    <li  lay-id="44">登录设置</li>
    <li  lay-id="55">智齿客服</li>
    <li  lay-id="66">兑吧配置</li>
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
    	<form class="layui-form form1" action="{:url('set/edit')}">
    	<fieldset class="layui-elem-field layui-field-title">
		  <legend>首页轮播图</legend>
		  <div class="layui-field-box">
		  		{for start="0" end="5"}
				<div class="layui-form-item">
					<label class="layui-form-label">图{$i}：</label>
					<div class="layui-input-inline" style="width:300px;">
					  <input type="text" name="config[app_index_banner][{$i}][url]" value="{$app_index_banner[$i]['url']}"  placeholder="请输入url/商品:id/功能名称" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-input-inline">
				      <select name="config[app_index_banner][{$i}][type]">
				        <option value="">类型</option>
				        {volist name=":config('site.app_func_type')" id="vo" key="kk"}
				        <option value="{$key}">{$vo}</option>
				        {/volist}
				      </select>
				    </div>
				    <div class="layui-input-inline">
				      <select name="config[app_index_banner][{$i}][action]">
				        <option value="">app功能</option>
				        {volist name=":config('site.app_func_action')" id="vo" key="kkk"}
				        <option value="{$key}">{$vo.title}</option>
				        {/volist}
				      </select>
				    </div>
					<div>
						<span class="upcb">
							<span class="img">{notempty name="app_index_banner[$i]['img']"}<img src="{$app_index_banner[$i]['img']|get_img}">{/notempty}</span>
							<span class="ipt"><input type="hidden" name="config[app_index_banner][{$i}][img]" value="{$app_index_banner[$i]['img']}"></span>
						</span>
						<button type="button" class="layui-btn up1">
						  <i class="layui-icon">&#xe67c;</i>上传图片
						</button>
					</div>
				</div>
				{/for}
		  </div>
		</fieldset>
		<fieldset class="layui-elem-field layui-field-title">
		  <legend>图标</legend>
		  <div class="layui-field-box">
		    {for start="0" end="10"}
		    <div class="layui-form-item">
				<label class="layui-form-label">图{$i+1}：</label>
				<div class="layui-input-inline" style="width: 100px;">
				  <input type="text" name="config[app_index_icon][{$i}][name]" value="{$app_index_icon[$i]['name']}" required   placeholder="名称" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-input-inline" style="width: 200px;">
				  <input type="text" name="config[app_index_icon][{$i}][url]" value="{$app_index_icon[$i]['url']}" required   placeholder="请输入url/商品:id/功能名称" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-input-inline">
			      <select name="config[app_index_icon][{$i}][type]">
			        <option value="">类型</option>
			        {volist name=":config('site.app_func_type')" id="vo" key="kk"}
				    <option value="{$key}">{$vo}</option>
				    {/volist}
			      </select>
			    </div>
			    <div class="layui-input-inline">
			      <select name="config[app_index_icon][{$i}][action]">
			        <option value="">app功能</option>
			        {volist name=":config('site.app_func_action')" id="vo" key="kkk"}
			        <option value="{$key}">{$vo.title}</option>
			        {/volist}
			      </select>
			    </div>
				<div>
					<span class="upcb">
						<span class="img">{notempty name="app_index_icon[$i]['img']" }<img src="{$app_index_icon[$i]['img']|get_img}">{/notempty}</span>
						<span class="ipt"><input type="hidden" name="config[app_index_icon][{$i}][img]" value="{$app_index_icon[$i]['img']}"></span>
					</span>
					<button type="button" class="layui-btn up1">
					  <i class="layui-icon">&#xe67c;</i>上传图片
					</button>
				</div>
			</div>
		    {/for}
		  </div>
		</fieldset>
		<fieldset class="layui-elem-field layui-field-title">
		  <legend>版块</legend>
		  <div class="layui-field-box">
		  	 <div class="layui-row layui-col-space10">
			    <div class="layui-col-lg3" style="text-align: center;">
			      <img src="__IMG__/bk_demo.png" width="300">
			    </div>
			    <div class="layui-col-lg9">
			    	{for start="0" end="8"}
				    <div class="layui-form-item">
						<label class="layui-form-label">版块{$i+1}：</label>
						<div class="layui-input-inline" style="width: 300px;">
						  <input type="text" name="config[app_index_bk][{$i}][url]" value="{$app_index_bk[$i]['url']}" placeholder="请输入url/商品:id/功能名称" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-input-inline">
					      <select name="config[app_index_bk][{$i}][type]" >
					        <option value="">类型</option>
					        {volist name=":config('site.app_func_type')" id="vo" key="kk"}
						    <option value="{$key}">{$vo}</option>
						    {/volist}
					      </select>
					    </div>
					    <div class="layui-input-inline">
					      <select name="config[app_index_bk][{$i}][action]">
					        <option value="">app功能</option>
					        {volist name=":config('site.app_func_action')" id="vo" key="kkk"}
					        <option value="{$key}">{$vo.title}</option>
					        {/volist}
					      </select>
					    </div>
						<div>
							<span class="upcb">
								<span class="img">{notempty name="app_index_bk[$i]['img']" }<img src="{$app_index_bk[$i]['img']|get_img}">{/notempty}</span>
								<span class="ipt"><input type="hidden" name="config[app_index_bk][{$i}][img]" value="{$app_index_bk[$i]['img']}"></span>
							</span>
							<button type="button" class="layui-btn up1">
							  <i class="layui-icon">&#xe67c;</i>上传图片
							</button>
						</div>
					</div>
				    {/for}
			    </div>
			  </div>
		  </div>
		</fieldset>
		<hr/>
			<div class="layui-form-item">
			  <div class="layui-input-block">
			    <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form1">立即提交</button>
			  </div>
			</div>
		</form>
 		
     </div>
     <div class="layui-tab-item">
     	<form class="layui-form form2" action="{:url('set/edit')}">
     		<div class="layui-form-item">
			    <label class="layui-form-label">app下载地址</label>
			    <div class="layui-input-block" style="width: 500px;">
			      <input type="text" name="config[app_down_url]" value="{$config.app_down_url}"  placeholder="" autocomplete="off" class="layui-input">
			    </div>
			</div>
     		<div class="layui-form-item">
			    <label class="layui-form-label">客服链接</label>
			    <div class="layui-input-block" style="width: 400px;">
			      <input type="text" name="config[app_kf_url]" value="{$config.app_kf_url}"  placeholder="" autocomplete="off" class="layui-input">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">新手教程链接</label>
			    <div class="layui-input-block" style="width: 400px;">
			      <input type="text" name="config[app_xsjc_url]" value="{$config.app_xsjc_url}"  placeholder="" autocomplete="off" class="layui-input">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">帮助中心链接</label>
			    <div class="layui-input-block" style="width: 500px;">
			      <input type="text" name="config[app_help_url]" value="{$config.app_help_url}"    placeholder="是链接哟" autocomplete="off" class="layui-input">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">代理特权[标题]</label>
			    <div class="layui-input-block" style="width: 300px;">
			      <input type="text" name="config[app_center_ad][title]" value="{$app_center_ad.title}"    autocomplete="off" class="layui-input">
			    </div>
			    <div class="layui-form-mid layui-word-aux">*标题为空不显示</div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">代理特权[内容]</label>
			    <div class="layui-input-block" style="width: 500px;">
			      <input type="text" name="config[app_center_ad][con]" value="{$app_center_ad.con}"     autocomplete="off" class="layui-input">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">代理特权介绍上半部分</label>
			    <div class="layui-input-block" style="width: 80px;">
			      <input type="text" name="config[app_center_ad][intro_top]" value="{$app_center_ad.intro_top}"    autocomplete="off" class="layui-input">
			    </div>
			    <div class="layui-form-mid layui-word-aux">*文章id</div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">代理特权介绍下半部分</label>
			    <div class="layui-input-block" style="width: 80px;">
			      <input type="text" name="config[app_center_ad][intro_bottom]" value="{$app_center_ad.intro_bottom}"    autocomplete="off" class="layui-input">
			    </div>
			    <div class="layui-form-mid layui-word-aux">*文章id</div>
			</div>
			<hr>
			<div class="layui-form-item">
			    <label class="layui-form-label">用户隐私协议[url]</label>
			    <div class="layui-input-block" style="width: 500px;">
			      <input type="text" name="config[app_user_protocol]" value="{$config.app_user_protocol}"     autocomplete="off" class="layui-input">
			    </div>
			</div>

			<fieldset class="layui-elem-field">
			  <legend>搜券教程</legend>
			  <div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">标题搜索</label>
				    <div class="layui-input-block" style="width: 200px;">
				      <input type="number" name="config[app_souquan_help][1]" value="{$app_souquan_help.1}" placeholder="文章的id,不是网址" autocomplete="off" class="layui-input">
				    </div>
				</div>
			  </div>
			  <div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">赚钱教程</label>
				    <div class="layui-input-block" style="width: 200px;">
				      <input type="number" name="config[app_souquan_help][2]" value="{$app_souquan_help.2}" placeholder="文章的id,不是网址" autocomplete="off" class="layui-input">
				    </div>
				</div>
			  </div>
			  <div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">新手必看</label>
				    <div class="layui-input-block" style="width: 200px;">
				      <input type="number" name="config[app_souquan_help][3]" value="{$app_souquan_help.3}" placeholder="文章的id,不是网址" autocomplete="off" class="layui-input">
				    </div>
				</div>
			  </div>
			</fieldset>

     		<hr/>
			<div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form2">立即提交</button>
              </div>
            </div>
     	</form>
     </div>
     <div class="layui-tab-item">
		<form class="layui-form form3" action="{:url('set/edit')}">
			<div class="layui-form-item">
			    <label class="layui-form-label">苹果审核开关</label>
			    <div class="layui-input-inline" >
			      <select name="config[app_apple_examine][is_open]" lay-verify="required">
			        <option value=""></option>
			        <option value="0">关闭</option>
			        <option value="1">开启</option>
			      </select>
			    </div>
			</div>
			<div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">苹果审核版本号</label>
				    <div class="layui-input-inline">
				      <input type="text" name="config[app_apple_examine][version]" value="{$app_apple_examine.version}" placeholder="版本号" autocomplete="off" class="layui-input">
				    </div>
				</div>
			  </div>
	     	<hr/>
			<div class="layui-form-item">
	          <div class="layui-input-block">
	            <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form3">立即提交</button>
	          </div>
	        </div>
        </form>
     </div>
     <div class="layui-tab-item">
		<form class="layui-form form4" action="{:url('set/edit')}">
			<div class="layui-form-item">
			    <label class="layui-form-label">微信登录开关</label>
			    <div class="layui-input-inline" >
			      <select name="config[app_wx_login]" lay-verify="required">
			        <option value=""></option>
			        <option value="0">关闭</option>
			        <option value="1">开启</option>
			      </select>
			    </div>
			</div>
	     	<hr/>
			<div class="layui-form-item">
	          <div class="layui-input-block">
	            <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form4">立即提交</button>
	          </div>
	        </div>
        </form>
     </div>
     <div class="layui-tab-item">
		<form class="layui-form form5" action="{:url('set/edit')}">
			<div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">appkey:</label>
				    <div class="layui-input-inline" style="width: 300px;">
				      <input type="text" name="config[app_zhichi][appkey]" value="{$config.app_zhichi.appkey}" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*更多配置等待扩展</div>
				</div>

			</div>

	     	<hr/>
			<div class="layui-form-item">
	          <div class="layui-input-block">
	            <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form5">立即提交</button>
	          </div>
	        </div>
        </form>
     </div>
     <div class="layui-tab-item">
		<form class="layui-form form5" action="{:url('set/edit')}">
			<div class="layui-field-box">
			  	<div class="layui-form-item">
				    <label class="layui-form-label">appkey:</label>
				    <div class="layui-input-inline" style="width: 300px;">
				      <input type="text" name="config[app_duiba][appkey]" value="{$config.app_duiba.appkey}" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*http://hd.dlp.duiba.com.cn/static/index?appId=54988#/setting/sub/appInfo</div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">appsecret:</label>
				    <div class="layui-input-inline" style="width: 300px;">
				      <input type="text" name="config[app_duiba][appsecret]" value="{$config.app_duiba.appsecret}" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*http://hd.dlp.duiba.com.cn/static/index?appId=54988#/setting/sub/appInfo</div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">签到链接:</label>
				    <div class="layui-input-inline" style="width: 80%;">
				      <input type="text" name="config[app_duiba][sign_url]" value="{$config.app_duiba.sign_url}" autocomplete="off" class="layui-input" >
				    </div>
				    <div class="layui-form-mid layui-word-aux">*只取dbredirect参数</div>
				</div>
				<!-- <div class="layui-form-item">
				    <label class="layui-form-label">商城链接:</label>
				    <div class="layui-input-inline" style="width: 80%;">
				      <input type="text" name="config[app_duiba][mall_url]" value="{$config.app_duiba.mall_url}" autocomplete="off" class="layui-input" disabled="">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*只取dbredirect参数</div>
				</div> -->
				<div class="layui-form-item">
				    <label class="layui-form-label">免登录地址:</label>
				    <div class="layui-input-inline" style="width: 80%;">
				      <input type="text" value="{:config('site.domain')}/api/user/duiba_autologin" placeholder="" autocomplete="off" class="layui-input" disabled="">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*请填入兑吧后台,可不填</div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">扣除积分url:</label>
				    <div class="layui-input-inline" style="width: 80%;">
				      <input type="text" value="{:config('site.domain')}/api/duiba/score_dec" placeholder="" autocomplete="off" class="layui-input" disabled="">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*请填入兑吧后台</div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">增加积分url:</label>
				    <div class="layui-input-inline" style="width: 80%;">
				      <input type="text" value="{:config('site.domain')}/api/duiba/score_inc" placeholder="" autocomplete="off" class="layui-input" disabled="">
				    </div>
				    <div class="layui-form-mid layui-word-aux">*请填入兑吧后台</div>
				</div>

			</div>

	     	<hr/>
			<div class="layui-form-item">
	          <div class="layui-input-block">
	            <button class="layui-btn" lay-submit lay-submit="" lay-filter="ajax-post" type="submit" target-form="form5">立即提交</button>
	          </div>
	        </div>
        </form>
     </div>

  </div>
</div> 

{/block}

{block name="script"}
<script type="text/javascript">
layui.use(['tool','element','upload'],function(){
	var $ = layui.jquery,layer = layui.layer,form = layui.form,tool = layui.tool,element = layui.element,upload = layui.upload;
	//Hash地址的定位
	var layid = location.hash.replace(/^#test=/, '');
	element.tabChange('test', layid);
	element.on('tab(test)', function(elem){
		location.hash = 'test='+ $(this).attr('lay-id');
	});
	//上传图片-app图
	var uploadInst = upload.render({
		elem: '.up1' //绑定元素
		,url: '{:url('Ajax/upload')}' //上传接口
		,done: function(res){
		  //上传完毕回调
		  var item = this.item;
		  if (res.code==1) {
		  		$(item).prev('.upcb').children('.img').html('<img src="'+res.data.url+'"/>')
		  		$(item).prev('.upcb').find('.ipt input').val(res.data.id);
		    	//$('#iptiab').val(res.data.id);
		    	//$('.appheadimg img').attr('src',res.data.url);
		    }else{
		    	layer.msg(res.data,{icon:2});
		    }
		}
		,error: function(){
		  //请求异常回调
		  layer.msg('上传异常~');
		}
	});
	//
	{volist name="app_index_banner" id="vo"}
	tool.setValue('config[app_index_banner][{$i-1}][type]','{$vo.type}');
	tool.setValue('config[app_index_banner][{$i-1}][action]','{$vo.action}');
	{/volist}
	{volist name="app_index_icon" id="vo"}
	tool.setValue('config[app_index_icon][{$i-1}][type]','{$vo.type}');
	tool.setValue('config[app_index_icon][{$i-1}][action]','{$vo.action}');
	{/volist}
	{volist name="app_index_bk" id="vo"}
	tool.setValue('config[app_index_bk][{$i-1}][type]','{$vo.type}');
	tool.setValue('config[app_index_bk][{$i-1}][action]','{$vo.action}');
	{/volist}
	tool.setValue('config[app_apple_examine][is_open]','{$app_apple_examine.is_open}');
	tool.setValue('config[app_wx_login]','{$config.app_wx_login}');
	tool.setValue('config[app_goods_open_type]','{$config.app_goods_open_type}');
});
</script>
{/block}